package com.zhuss.controller.core;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zhuss.bean.bo.core.role.CareRolePermissionListBo;
import com.zhuss.bean.bo.core.role.CareRoleUserListBo;
import com.zhuss.bean.bo.core.role.DetailRoleBo;
import com.zhuss.bean.bo.core.role.SearchRoleBo;
import com.zhuss.common.AbstractBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.ReadService;
import com.zhuss.core.role.RoleReadServiceExt;
import com.zhuss.exception.AabException;


/**
 * 角色查询 controller
 * @Author zhushanshuo
   @Date 2019-11-27 19:58
 *
 */
  
 
@RestController
@RequestMapping("/role")
public class RoleReadController extends BaseController {
	
	@Autowired
	@Qualifier("roleReadService")
	private ReadService<Object, Object> roleReadService;
	
	@Autowired
	@Qualifier("roleReadServiceExt")
	private RoleReadServiceExt roleReadServiceExt;
	
	/**
	 * 详情
	 * @param bo
	 * @return
	 * @throws AabException
	 */
	@ResponseBody
	@RequestMapping("/detail")
    public Object detail(@RequestBody DetailRoleBo bo) throws AabException {
		
		Object result = roleReadService.detail(bo);
		return result;
    }
	
	/**
	 * 列表
	 * @param bo
	 * @return
	 * @throws AabException
	 */
	@ResponseBody
    @RequestMapping("/list")
    public Object list(@RequestBody SearchRoleBo bo) throws AabException {
		
		Object result = roleReadService.list(bo);
		return result;
    }
	
	
	/**
	 * 查询角色的权限树
	 * @param bo
	 * @return
	 * @throws AabException
	 */
	@ResponseBody
	@RequestMapping("/careRolePermissionList")
    public Object careRolePermissionList(@RequestBody CareRolePermissionListBo bo) throws AabException {
		
		Object result = roleReadServiceExt.careRolePermissionList(bo);
		return result;
    }
	
	
	/**
	 * 查询角色的用户
	 * @param bo
	 * @return
	 * @throws AabException
	 */
	@ResponseBody
	@RequestMapping("/careRoleUserList")
    public Object careRoleUserList(@RequestBody CareRoleUserListBo bo) throws AabException {
		
		Object result = roleReadServiceExt.careRoleUserList(bo);
		return result;
    }
	
	/**
	 * 查询角色列表
	 * @param bo
	 * @return
	 * @throws AabException
	 */
	@ResponseBody
	@RequestMapping("/roleList")
    public Object roleList(@RequestBody AbstractBo bo) throws AabException {
		
		Object result = roleReadServiceExt.roleList(bo);
		return result;
    }
	


	
}
